package com.april.pattern.structural.flyweight;

import org.junit.jupiter.api.Test;

/**
 * @author April
 * @version V1.0.0
 * @date 2019/07/04 16:06
 * @description
 */
public class FlyWeightTest {
    @Test
    public void flyWeightTest() {
        ChessFlyWeight chess1 = ChessFlyWeightFactory.getChessFlyWeight("黑色");
        ChessFlyWeight chess2 = ChessFlyWeightFactory.getChessFlyWeight("黑色");
        System.out.println(chess1);
        System.out.println(chess2);

        System.out.println("增加外部的状态============");

        chess1.display(new Coordinate(10, 10));
        chess2.display(new Coordinate(20, 20));
        System.out.println(chess1);
        System.out.println(chess2);
    }
}
